/*
* $Id: CommonControl.cpp 2 2009-12-23 13:58:02Z volok-aleksej@yandex.ru $
*
* Copyright 2008-2009 by Volokitin Alexey
* All rights reserved
*
*/
#include "Common/include.h"
#include "UserMessage.h"
#include "CommonControl.h"

CCommonControl::CCommonControl(){}
CCommonControl::~CCommonControl(){}
void CCommonControl::OnKeyDown(int nChar, CWnd* m_pParent){
	if(nChar == VK_TAB)
		m_pParent->SendMessage(UM_TABSTOP, 0, (LPARAM)this);
	else
		m_pParent->PostMessage(UM_VALIDATE, 0, 0);
}

CCommonButton::CCommonButton(){}
CCommonButton::~CCommonButton(){}

BEGIN_MESSAGE_MAP(CCommonButton, CButton)
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()

void CCommonButton::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags){
	__super::OnKeyDown(nChar, nRepCnt, nFlags);
	__super::OnKeyDown(nChar, GetParent());
}

CCommonEdit::CCommonEdit(){}
CCommonEdit::~CCommonEdit(){}

BEGIN_MESSAGE_MAP(CCommonEdit, CEdit)
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()

void CCommonEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags){
	__super::OnKeyDown(nChar, nRepCnt, nFlags);
	__super::OnKeyDown(nChar, GetParent());
}

CCommonCombobox::CCommonCombobox(){}
CCommonCombobox::~CCommonCombobox(){}

BEGIN_MESSAGE_MAP(CCommonCombobox, CComboBox)
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()

void CCommonCombobox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags){
	__super::OnKeyDown(nChar, nRepCnt, nFlags);
	__super::OnKeyDown(nChar, GetParent());
}

CCommonListBox::CCommonListBox(){}
CCommonListBox::~CCommonListBox(){}

BEGIN_MESSAGE_MAP(CCommonListBox, CListBox)
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()

void CCommonListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags){
	__super::OnKeyDown(nChar, nRepCnt, nFlags);
	__super::OnKeyDown(nChar, GetParent());
}

CCommonDateTimeCtrl::CCommonDateTimeCtrl(){}
CCommonDateTimeCtrl::~CCommonDateTimeCtrl(){}

BEGIN_MESSAGE_MAP(CCommonDateTimeCtrl, CDateTimeCtrl)
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()

void CCommonDateTimeCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags){
	__super::OnKeyDown(nChar, nRepCnt, nFlags);
	__super::OnKeyDown(nChar, GetParent());
}